<?php

namespace App\Admin\Controllers;

use App\Patent;
use Encore\Admin\Controllers\AdminController;
use Encore\Admin\Form;
use Encore\Admin\Grid;
use Encore\Admin\Show;

class PatentKeepController extends AdminController
{
    /**
     * Title for current resource.
     *
     * @var string
     */
    protected $title = '专利维持';

    /**
     * Make a grid builder.
     *
     * @return Grid
     */
    protected function grid()
    {
        $grid = new Grid(new Patent());
        $grid->column('patent_sn', __('Patent sn'));
        $grid->column('patent_name', __('Patent name'));
        $grid->column('apply_date', __('Apply date'));
        $grid->column('patent_type_id', __('Patent type id'));
        $grid->column('department_id', __('Department id'));
        $grid->column('keep_status', __('Keep status'));

        return $grid;
    }

    /**
     * Make a show builder.
     *
     * @param mixed $id
     * @return Show
     */
    protected function detail($id)
    {
        $show = new Show(Patent::findOrFail($id));

        $show->field('patent_name', __('Patent name'));

        return $show;
    }

    /**
     * Make a form builder.
     *
     * @return Form
     */
    protected function form()
    {
        $form = new Form(new Patent());

        $form->hidden('keep_status', __('Keep status'));

        return $form;
    }
}
